import { UPLOAD, GET, RequesPromise } from '@/libs/index';

/**
 * 请求示例
 */

/**
 * 接口返回的数据格式
 */
interface ExampleReponseData {
  /**
   * 示例名称
   */
  name: string;
}

/**
 * 获取示例数据
 */
export function getExampleData(): Promise<ExampleReponseData> {
  return Promise.resolve({ name: 'example' });
}

/**
 * 上传文件
 */
export function uploadImage<P = Record<string, any>, D = Record<string, any>>(filePath: string, params?: P, data?: D) {
  return UPLOAD({
    url: '/uploadFile',
    filePath,
    data,
    params,
    name: 'file'
  });
}

/**
 * 示例获取信息
 */
export function getExample(): RequesPromise<{ name: string }> {
  return GET({
    url: '/getExample'
  });
}
